segfault when waypoints didn't have descriptions e.g. '-i arc'
authorparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 17 Sep 2004 20:33:02 +0000 (20:33 +0000)
committerparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 17 Sep 2004 20:33:02 +0000 (20:33 +0000)
gpsbabel/waypt.c

index 04acd2ec1f7d556d520ebffd5d6d46ded70e6f31..f91b503f22231239256862fa3dddc43720ac456f 100644 (file)
@@ -131,15 +131,17 @@ waypt_disp(const waypoint *wpt)
        }
        printposn(wpt->latitude,1);
        printposn(wpt->longitude,0);
-       
-       tmpdesc = str_utf8_to_ascii( wpt->description);
-       printf("%s/%s", 
-               global_opts.synthesize_shortnames ? 
+
+       if ( wpt->description ) {       
+               tmpdesc = str_utf8_to_ascii( wpt->description);
+               printf("%s/%s", 
+                       global_opts.synthesize_shortnames ? 
                        mkshort(mkshort_handle, tmpdesc) : 
                                wpt->shortname, 
                                tmpdesc);
-       if ( tmpdesc ) 
-               xfree(tmpdesc);
+               if ( tmpdesc ) 
+                       xfree(tmpdesc);
+       }
 
        if (wpt->altitude != unknown_alt)
                printf(" %f", wpt->altitude);